package com.ruoyi.project.erp.scheduled;

import com.ruoyi.project.erp.service.IDingTalkService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.List;

@Configuration
public class ScheduledTask {

    @Autowired
    private IDingTalkService dingTalkService;

    @Autowired
    private TaskScheduler taskScheduler;

    @Autowired
    private ISysDeptService sysDeptService;

    @PostConstruct
    public void scheduleOnce() {
        // 延迟10秒后执行
        taskScheduler.schedule(this::runTask, new Date(System.currentTimeMillis() + 10000));
    }

    public void runTask() {
//        dingTalkService.getToken();
        System.out.println("任务执行，只执行一次");
//        dingTalkService.syncListDept();
//        dingTalkService.syncListRolePost();
//        dingTalkService.syncListUser();

    }


}
